package ph.gov.marikina.mcsmtms.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonBackReference;

import ph.gov.marikina.mcsmtms.constants.GlobalConstants.SituationTypes;
import ph.gov.marikina.mcsmtms.constants.GlobalConstants.TrafficConditionTypes;

@Entity
@Table(name="situation_segment")
public class SituationSegment implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 956792142543413089L;
	
	@Id
	@GeneratedValue
	@Column(name="id")
	private Integer id;
	//private String situationReportId;

	@Column(name="situation", nullable=false)
	private String situation;
	
	@Column(name="trafficCondition", nullable=false)
	private String trafficCondition;
	
	@Column(name="description")
	private String description;
	
	@Column(name="accessibleYn", nullable=false)
	private Boolean accessibleYn;
	
	@Column(name="start_lat", nullable=false)
	private Float startLat;
	
	@Column(name="start_lng", nullable=false)
	private Float startLng;
	
	@Column(name="end_lat", nullable=false)
	private Float endLat;
	
	@Column(name="end_lng", nullable=false)
	private Float endLng;
	
	@ManyToOne
	@JoinColumn(name = "situation_report_id")
	private SituationReport situationReport;
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	
	public String getSituation() {
		return situation;
	}
	
	public String getSituationDesc() {
		if(null == situation || situation.isEmpty()) return "";
		return SituationTypes.getDescriptionByCode(situation);
	}
	
	public void setSituation(String situation) {
		this.situation = situation;
	}
	
	public String getTrafficCondition() {
		return trafficCondition;
	}
	
	public String getTrafficConditionDesc() {
		if(null == trafficCondition || trafficCondition.isEmpty()) return "";
		return TrafficConditionTypes.getDescriptionByCode(trafficCondition);
	}
	
	public void setTrafficCondition(String trafficCondition) {
		this.trafficCondition = trafficCondition;
	}
	
	
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
	
	public Boolean getAccessibleYn() {
		return accessibleYn;
	}
	public void setAccessibleYn(Boolean accessibleYn) {
		this.accessibleYn = accessibleYn;
	}
	
	
	public Float getStartLat() {
		return startLat;
	}
	public void setStartLat(Float startLat) {
		this.startLat = startLat;
	}
	
	
	public Float getStartLng() {
		return startLng;
	}
	public void setStartLng(Float startLng) {
		this.startLng = startLng;
	}
	
	
	public Float getEndLat() {
		return endLat;
	}
	public void setEndLat(Float endLat) {
		this.endLat = endLat;
	}
	
	public Float getEndLng() {
		return endLng;
	}
	public void setEndLng(Float endLng) {
		this.endLng = endLng;
	}

	@JsonBackReference
	public SituationReport getSituationReport() {
		return situationReport;
	}
	public void setSituationReport(SituationReport situationReport) {
		this.situationReport = situationReport;
	}

}
